import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'

// withRouter(高阶组件)  ==>  给当前组件添加路由信息
class App extends Component {
    login = () => {
        this.props.history.push('/login')
    }
    render() {
        console.log(this.props)
        return (
            <div>
                AppApp
                <div>
                    {/* 编程式跳转 */}
                    <button onClick = {() => {
                        this.login()
                    }}>点我跳转</button>
                </div>
            </div>
        )
    }
}


export default App
// export default withRouter(App)
